import {loadEnv, mergeConfig} from 'vite';

import baseConfig from './vite.config.base';

export default mergeConfig(
  {
    mode: 'development',
    server: {
      open: true,
      fs: {
        strict: true,
      },
        proxy: {
            '/admin': {
                target: loadEnv('development', '.').VITE_PROXY,
                rewrite: (path) => path.replace(/^\/admin/, '/admin'),
                changeOrigin:true,
                configure: (server) =>
                    // 拦截请求 打印地址。方便辨认重定向后的地址是否正确 没有端口信息
                    server.on('proxyReq', (req) =>
                        console.log(`${req.host}${req.path}`)
                    ),
            },
        },
    },
   
  },
  baseConfig
);
